<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>倾斜模型</title>
    <link href="../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
    <script src="./js/config.js"></script>
    <script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>

</head>

<body>
    <div id="cesiumContainer"></div>

    <script type="text/javascript">
        function onload(Cesium) {
            //初始化viewer部件
            var viewer = new Cesium.Viewer('cesiumContainer', {
                imageryProvider: new Cesium.BingMapsImageryProvider({
                    // url: 'https://dev.virtualearth.net',
                    url: 'http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace',
                    mapStyle: Cesium.BingMapsStyle.AERIAL,
                    key: URL_CONFIG.BING_MAP_KEY
                })
            });
            var scene = viewer.scene;
            var widget = viewer.cesiumWidget;
            var sceneLayer;

            try {
                var Config = "http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace/datas/Config/config" //达州汇鑫能源有限公司
                var Config_1 = "http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace/datas/Config_1/config" //四川达兴宝化化工有限公司
                var Config_2 = "http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace/datas/Config_2/config"//威顿达州化工有限责任公司 , 翁福达州化工有限责任公司
                var Config_3 = "http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace/datas/Config_3/config"  //玖源化工
                var Config_4 = "http://sm.dz.skycn.tech/iserver/services/3D-fenkuai/rest/realspace/datas/Config_4/config"
                var promise = scene.addS3MTilesLayerByScp(Config_1, {
                    name: 'dazhouanjian'
                });
                Cesium.when(promise, function (layer) {
                    sceneLayer = layer;
                    //设置相机位置，定位至模型  
                    scene.camera.setView({
                        //将经度、纬度、高度的坐标转换为笛卡尔坐标
                        destination: new Cesium.Cartesian3.fromDegrees(107.464, 31.136, 350.00),
                        orientation: {
                            heading: Cesium.Math.toRadians(45.0),
                            pitch: Cesium.Math.toRadians(0),
                            roll: Cesium.Math.toRadians(0),
                        }
                    });
                }, function () {
                    var title = '加载SCP失败，请检查网络连接状态或者url地址是否正确？';
                    widget.showErrorPanel(title, undefined, e);
                });
            }
            catch (e) {
                if (widget._showRenderLoopErrors) {
                    var title = '渲染时发生错误，已停止渲染。';
                    widget.showErrorPanel(title, undefined, e);
                }
            }


        }
    </script>
</body>

</html>